#region File Header
//----------------------------------------------------------------
// Copyright (C) 2002 Stefan Kyntchev
// All rights reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY 
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT 
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR 
// FITNESS FOR A PARTICULAR PURPOSE.
//----------------------------------------------------------------
#endregion File Header

namespace FlashBack.Web
{
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
	using System.IO;
	using AirWeb.DirectoryMgr;
	using AirWeb.WebControls.BandsControl;
	using AirWeb.Security;
	using AirWeb.Security.FileSecurity;
	using AirWeb.ApplicationTools;


    /// <summary>
    ///    Summary description for PicNavigator.
    /// </summary>
    public partial class PicNavigator : PageBase
    {
		protected System.Web.UI.WebControls.Label LastModified = new Label();
	
	public PicNavigator()
	{
	    Page.Init += new System.EventHandler(Page_Init);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
			if (!IsPostBack)
			{
				MyBands.AddBand(new Band("Albums","WhatIsNew.aspx",true));
				MyBands.AddBand(new Band("Search","Search.aspx",false));

				// Add administration or statistics band
				Band admin;
				if(CurrentUser.IsAdministrator())
				{
					admin = new Band("Administration","",false);

					HyperLink roles = new HyperLink();
					roles.Text = "Manage Roles <br/>";
					roles.NavigateUrl = "javascript:top.NavigateMainView('ManageRoles.aspx')";
					roles.CssClass = "searchBody";

					HyperLink users = new HyperLink();
					users.Text = "Manage Users <br/>";
					users.NavigateUrl = "javascript:top.NavigateMainView('ManageUsers.aspx')";;
					users.CssClass = "searchBody";

					HyperLink mails = new HyperLink();
					mails.Text = "Send E-mails <br/>";
					mails.NavigateUrl = "javascript:top.NavigateMainView('SendEmails.aspx')";
					mails.CssClass = "searchBody";

					HyperLink sitelog = new HyperLink();
					sitelog.Text = "Visitor List<br/>";
					sitelog.NavigateUrl = "javascript:top.NavigateMainView('LogsViewer.aspx')";
					sitelog.CssClass = "searchBody";

					admin.ContentCell.Controls.Add(users);
					admin.ContentCell.Controls.Add(roles);
					admin.ContentCell.Controls.Add(mails);
					admin.ContentCell.Controls.Add(sitelog);

					admin.ContentCell.Style["padding-left"] = "10";
					MyBands.AddBand(admin);

				}

				// Hide the upload link if users can't upload
				ExtraUserData eud = null;
				try
				{
					eud = (ExtraUserData)CurrentUser.ExtraData;
				}
				catch
				{}

				// Show the upload link only if the user has 
				// rights to upload and upload directory was
				// configured in the Web.config file
				if( eud != null && eud.CanUpload == true )
				{
					DirectoryHelper h = new DirectoryHelper();
					if(h.PublicFolderVirtualRoot != string.Empty)
						UploadLink.Visible = true;
				}
			}

        }

        protected void Page_Init(object sender, EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP+ Windows Form Designer.
            //
            InitializeComponent();
        }

        /// <summary>
        ///    Required method for Designer support - do not modify
        ///    the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {

		}
    }
}
